#include "stdafx.h"
#include "ZBar.h"
#include "Camera.h"

bool ZBar::Init()
{
	if ( !m_tile[0].Create("../Media/Tile/tile3.png") )
		return false;
	m_tile[0].SetSize(m_size, m_size);
	if ( !m_tile[1].Create("../Media/Tile/tile4.png") )
		return false;
	m_tile[1].SetSize(m_size, m_size);
	if ( !m_select.Create("../Media/Tile/tile5.png") )
		return false;
	m_select.SetSize(m_size, m_size);

	return true;
}

void ZBar::Draw()
{
	for ( int y = 0; y < GameConfig::Get().MapZ; y++ )
	{
		if ( y >= GameConfig::Get().LineHeight )
			m_tile[0].Draw(GetWidth() - m_offset - m_size, y*m_size);
		else
			m_tile[1].Draw(GetWidth() - m_offset - m_size, y*m_size);
	}
	m_select.Draw(GetWidth() - m_offset - m_size, Camera::Get().GetZ()*m_size);
	
}

void ZBar::Destroy()
{
	m_tile[0].Destroy();
	m_tile[1].Destroy();
	m_select.Destroy();
}